package com.ovhoo.android.smsbombing;

import java.util.ArrayList;
import java.util.Iterator;

public class MessagesHistory {
	private static int totalNumber = 0;
	private ArrayList<ShortMessage> messages;
	
	public MessagesHistory(){
		this.messages = new ArrayList<ShortMessage>();
	}
	
	public boolean addMessage(ShortMessage msg){
		Iterator _itr = this.messages.iterator();
		ShortMessage _m;
	
		while(_itr.hasNext()){
			_m = (ShortMessage) _itr.next();
			if(_m.getDestinator() == msg.getDestinator()){
				_m.setMessage(msg.getMessage());
				return false;
			}
		}
		
		this.messages.add(msg);
		return true;
	}
}
